Main.messageTray.connect('source-added', Lang.bind(this, this._onSourceAdded));
Main.messageTray.connect('source-removed', Lang.bind(this, this._onSourceRemoved));
+ Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount));
let sources = Main.messageTray.getSources();
sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); }));
}
let index = this._notificationQueue.indexOf(notification);
- if (index != -1)
+ if (index != -1) {
this._notificationQueue.splice(index, 1);
+ this.emit('queue-changed');
+ }
},
_onNotify: function(source, notification) {
this._notificationQueue.sort(function(notification1, notification2) {
return (notification2.urgency - notification1.urgency);
});
+ this.emit('queue-changed');
}
}
this._updateState();
this._updatingState = true;
// Filter out acknowledged notifications.
+ let changed = false;
this._notificationQueue = this._notificationQueue.filter(function(n) {
+ changed = changed || n.acknowledged;
return !n.acknowledged;
});
+ if (changed)
+ this.emit('queue-changed');
+
let hasNotifications = Main.sessionMode.hasNotifications;
if (this._notificationState == State.HIDDEN) {
_showNotification: function() {
this._notification = this._notificationQueue.shift();
+ this.emit('queue-changed');
this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME;
if (!this._userActiveWhileNotificationShown) {